package com.bosssoft.hr.javase;

/**
 * @Description: MyQueueExample
 * @Author: WengYu
 * @CreateTime: 2022/05/12 16:02
 */
public class MyQueueEx {

    public void testQueueAdd(){
        Queue<User> users = new MyQueue<>();
        int i;
        for (i=0; i < 5; i++) {
            users.add(new User(i,"user"+i));
        }
        assert i == 5 : "数据大于5";
    }

    public void testQueueRemove(){
        Queue<User> users = new MyQueue<>();
        users.add(new User(1,"user1"));
        users.add(new User(2,"user2"));
        users.add(new User(3,"user3"));
        users.add(new User(4,"user4"));
        users.add(new User(5,"user5"));
        boolean flag = true;
        for (int i = 0; i < 6; i++) {
            flag = users.poll() != null;
        }
        assert !flag : "第六次为false";
    }

}
